<%@ taglib prefix="c" uri="http://www.codecoord.com" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://www.codecoord.com/fmt" %>
<html>
<head>
    <title>我的收藏</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
    <script src="${pageContext.request.contextPath}/static/js/polyfill.js"></script><%--使ie兼容es6语法--%>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <link href="${pageContext.request.contextPath}/static/layui-v2.6.8/layui/css/layui.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/layui-v2.6.8/layui/layui.js"></script>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/static/jquery.mobile/jquery_mobile.css"/><%--此css内有修改,请勿更换文件和使用外部链接导入--%>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery/jquerymin.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery/jquery-1.11.0.js"></script>
    <script src="${pageContext.request.contextPath}/static/jquery.mobile/jquery_mobile.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.css">
    <script src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap-min.js"></script>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/static/css/meet.css"/>
    <script src="${pageContext.request.contextPath}/static/js/axios-min.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/live_meeting.css">
    <style>#navbar-default {
        background-color: #71BD71;
    }h3>a{
        border-left: 0;
        border-right: 0;
                }
        #jiansuo{
            width: 30%;
            text-shadow: none;
            border-color: white;
            box-shadow: none;
            margin: 10px auto;
            padding: 5px 10px;
            background-color: #B2F0AF;
            color: #A0A0A0;
        }
        .aui-footer-fixed{
        display: none;
    }
    .layui-layer-dialog{
        border-radius: 5px;
    }
    .layui-layer-btn a{
        height: auto !important;
    }
    </style>
</head>
<body>
<div data-role="page" id="pageone" style="margin-top: 40px">
    <div id="header" style="height: 13px">
        <nav id="navbar-default" class="navbar navbar-default top-nabar" role="navigation"
             style="overflow:hidden;position:fixed;top:0;width:100%;z-index:1002;margin-bottom: 10px;border: 0">
            <div class="row">
                <div class="container-fluid" id="fluid">
                    <div class="col-lg-1 col-md-1 col-xs-1 col-sm-1" style=";padding-left: 6px;">
                        <a class="navbar-brand" href="javascript:history.back(-1)"
                           style="padding-left: 3px;">
                            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                        </a>
                    </div>
                </div>
            </div>
        </nav>
        <br><br>
    </div>
    <div style="position: relative;margin-top: 5px;margin-bottom: 7px">
        <span class="glyphicon glyphicon-remove-circle" aria-hidden="true" style="position: absolute;top: 28%;left: 83%;color: #7C8383;display: none;"></span>
        <span id="quxiao" style="position: absolute;right: 3%;top: 20%;display: none;color: #b94a48" onclick="searchAll(0)">取消</span>
        <span  class="glyphicon glyphicon-search" aria-hidden="true" style="position: absolute;top: 28%;left: 25px;color: #777"></span>
        <span id="first_quxiao" style="color: #b94a48;position: absolute;top: 20%;right: 7%;">取消</span>
    <input class="jiansuoId" type="text" style="width: 100%;padding: 0;height: 100%;border-radius: 20px;" placeholder="根据会议标题搜索" onclick="searchAll()" ></div>
    <button id="jiansuo">搜索</button>
    <div class="alert alert-info">取消关注成功</div>
    <div id="all" data-role="main" class="ui-content" style="padding-top:0;margin-top: 5px">
        <div data-role="">
            <div data-role="collapsible" data-collapsed="false" style="margin-bottom: 50px">
                <h3>默认收藏
                <span style="font-size: 13px">${Collect.size()}</span></h3></h3>
                <c:forEach items="${Collect}" var="appointment" varStatus="status">
                    <ul data-role="listview" data-inset="true" class="${status.index}" style="border-bottom: 1px solid #eeeeee">
                        <li>
                            <a href="" onclick="window.location.href='/bokehall/views/meet/meeting_details.html?appointmentId=${appointment.id}'" style="border: 0;">
                                <img src="${pageContext.request.contextPath}/resource/images/qunaihuizheng.jpg" style="width: 95px;height: 60px;margin-left: 9px;margin-top: 7px;border-radius: 8px">
                                <%--<h2>群爱医疗会诊第${appointment.qaMeetNum}期</h2>--%>
                                <h2 style="margin-top: 0">${appointment.title}</h2>
                                <p>会议发起人:&nbsp;&nbsp;&nbsp;${appointment.doctorName}</p>
                                <p style="display: inline">涉及科室:&nbsp;&nbsp;&nbsp;${appointment.majors}</p>
                            </a>
                            <a href="javascript:void(0)" class="ui-btn ui-corner-all ui-icon-star ui-btn-icon-notext"
                               onclick="cancelCollect('${appointment.id}','${status.index}')" style="border: 0"></a>
                        </li>

                    </ul>
                </c:forEach>
            </div>
        </div>
    </div>

    <footer class="aui-footer aui-footer-fixed">

        <a href="" onclick="window.location.href='/boke/index.jsp'" class="aui-tabBar-item " style="text-decoration:none;">
            <span class="aui-tabBar-item-icon"><i class="icon icon-loan"></i></span>
            <span class="aui-tabBar-item-text">首页</span></a>

        <a href="" onclick="window.location.href='/bokehall/hall/allHall'" class="aui-tabBar-item aui-tabBar-item-active">
            <span class="aui-tabBar-item-icon"><i class="icon icon-credit"></i></span>
            <span class="aui-tabBar-item-text">会诊</span></a>

        <a href="" onclick="window.location.href='/boke/msg/chatfriend.jsp'" class="aui-tabBar-item ">
            <span class="aui-tabBar-item-icon"><i class="icon icon-ions"></i></span>
            <span class="aui-tabBar-item-text">消息</span></a>

        <a href="" onclick="window.location.href='/boke/me.jsp'" class="aui-tabBar-item "><span
                class="aui-tabBar-item-icon"><i class="icon icon-mine"></i></span>
            <span
                    class="aui-tabBar-item-text">我的
        </span></a>
    </footer>
</div>
</body>
<script>
    $(document).ready(function () {
        $("#jiansuo").hide();
        $("#header").hide();
        $("#pageone").css("margin-top","5px")
    });
    //取消关注
    function cancelAttention(i, j) {
        let form = new FormData();
        form.append("id", i)
        let msg = confirm("你确定取消关注此用户吗?");

        if (msg == true) {
            axios({
                method: "post",
                url: "${pageContext.request.contextPath}/my/cancelAttention",
                data: form
            })
                .then(function (response) {
                    if (response.data == "ok") {
                        $(".alert-info").show(0).delay(1500).hide(0);
                        $("." + j).remove(); //.parent()
                    }
                }).catch(function (error) {
                alert("出现错误,请重试")
            })
        }
    }
    //取消收藏
    function cancelCollect(i, j) {
        let form = new FormData();
        form.append("id", i)
        layer.confirm('取消收藏该会诊?', {
            btn: ['确定','关闭'], //按钮
            title:''
        }, function(){
            axios({
                method: "post",
                url: "${pageContext.request.contextPath}/my/cancelCollect",
                data: form
            })
                .then(function (response) {
                    if (response.data === "ok") {
                        layer.msg('取消收藏成功',{icon: 1});
                        $("." + j).remove();
                    }
                }).catch(function (error) {
                alert("出现错误,请重试")
            })
            layer.closeAll('dialog');
        }, function(){

        });
    }
    function searchAll(condition) {
        if(condition==0){
            $("#all").css("display","block");
            $(".ui-input-text").css("width","93%");
            $("#quxiao").css("display","none")
            $(".glyphicon-remove-circle").css("display","none")
            $("#jiansuo").hide();
            window.location.href='${pageContext.request.contextPath}/my/attention';
        }else{
        $("#jiansuo").show();
        $("#all").css("display","none");
        $(".ui-input-text").css("width","85%");
        $("#quxiao").css("display","block")
        $(".glyphicon-remove-circle").css("display","block")
        $("#first_quxiao").css("display","none")}
    }
    $(".glyphicon-remove-circle").click(function () {
        $("input").val('');
    })
    $("#jiansuo").click(function () {
       window.location.href='${pageContext.request.contextPath}/my/attention/'+$(".jiansuoId").val();
    })
    $("#first_quxiao").click(function () {
        window.location.href='${pageContext.request.contextPath}/my/attention';
    })
</script>
</html>
